#include <iostream>
#include <string>
#include <cmath>


// link with -lboost_filesystem-gcc -lboost_program_options-gcc
// program_options_helper.cpp
#include <boost/algorithm/string.hpp>
#include <boost/program_options.hpp>
#include <boost/foreach.hpp>

// my functions
#define DEBUG_LEVEL 6
#include <debug_func.h>
#include <open_stream_name_with_subscript.h>
#include <print_error.h>
#include <program_options_helper.h>

#include "get_arg.h"

using std::string;
using boost::split;
using boost::is_any_of;
using std::cerr;
using std::vector;
using namespace program_options_helper;
namespace po = boost::program_options_lg_lg;


//_______________________________________________________________________________________

//		process_command_line_options

//				from command line
//				Created [9/13/2001]

//_______________________________________________________________________________________
bool process_command_line_options(int argc, char* argv[], t_program_args& args)
{

	//
	// checked mandatory arguments
	//
	po::options_description mandatory_args("Mandatory Arguments");
	mandatory_args.add_options()
	("input_file,i", po::value<string>(&args.path)
											->set_name("FILE"),
									"Test file for counting lines.");

	args.add_std_options();
	
//	args.optional_args.add_options()
//		("eol,E", po::value<char>(&args.eol)
//											->set_name("CHAR")
//											->default_value('\n'),
//									"end of line character..");

	
	

	//	Parse all arguments
	//
	po::options_description all_args("");
	all_args

				//	Mandatory arguments
                .add(mandatory_args)

				//	Optional arguments
				.add(args.optional_args);

	po::variables_map vm;
	po::store(po::command_line_parser(argc, argv)
								.options(all_args)

								.run(), vm);
	po::notify(vm);





	
	check_required_options(vm, mandatory_args);

	if (vm.count("version"))
	{
		print_version(cerr, *argv, "1.0");
		return false;
	}
	string exe_description = "Tests String Partial Match for different paths";
	if (vm.count("help"))
	{
		print_usage(cerr, string(*argv), "[OPTIONS]",
							all_args, exe_description, 80);
		return false;
	}

	args.open_err_log();
	return true;
}








